public class HomeWork10_06{
    public static void main(String[] args){
        FourDigitDaffodil fdd = new FourDigitDaffodil();
        
        int t = 10000;
        while(--t >= 1000){
            if(fdd.isFourDigitDaffodil(t)){
                System.out.println(t);
            }
        }
    }
}

class FourDigitDaffodil{
    public boolean isFourDigitDaffodil(int itger){
        final int backUp = itger;
        
        int ans = itger / 1000;
        itger %= 1000;
        ans += itger / 100;
        itger %= 100;
        ans += itger / 10;
        ans += itger % 10;
        
        if(ans * ans * ans == backUp){
            return true;
        }
        return false;
    }
}